<?php

use Doraemon\service\Format\Note\HandleNote;
use Doraemon\pockets\constInterface\FormatScene;
use Biz\cache\activity\SuperBuyerPlanetObj;
use Doraemon\service\statSign\Basic as basicStatSign;
use Doraemon\pockets\constInterface\statSign\AutoModule;


class TreasureListAction extends ActionPlugin
{
    public const USER_LEVEL = self::LEVEL_REALNAME;

    const TAB_MAP_CONTENT = [
        '收纳'=>"005rkyt000000zw7,005s4ht000002way,005ryxq000000eb7,005rk6500000h4av,005s5xn0000379ht,005rwcb00006hvle,005sbme000000kuk,005sa3200008vkjx,005sooh00004dzf6,005ssdv00000p9ek,005rkhu000052tzo,005tzmr00002le0a,005txin00003a12v,005ttj200005h12i,005ttb40000083uk,005u6gn00002yj5c,005tp8l00000i3yl,005tj0l000001svl,005o59p00000xb95,005mxs70000013j9,005r5wx00003a12v,005n8vx000009add,005lvfb00000h4av,0058p1s00000fi68,005qj89000009nmu,005qk8z00002o3st,005sn0600002fmp1,005rn3f00003n5bd,005rpsf00003c7it,005sr3k000000rhc,005u08t00007eycd,005tlkl00004lg6u,005trff00005430f,005lztu0000135n1,005td0e0000009dd,005s0wl00000e7pr,005k2q5000000ta4,005r9ls00000mj0i,005auvh000004a7u,005hb5p000001fip,00550x7000000nt5,005k8x200006cx64,005pw1y0000039ee,005gl1d000000mvt,005lkgd0000083uk,005sx6500003yd4x,005s8pa000000kwf,005ql3w00005pvv2,005o0r200000p9ek,005hpfk00000cjp9,005s3zs000034uzy,005bntr00007syg7,005tj2z0000009f2,005pzg10000229qh,005poqh000023hqb,005i0kz000000kuk,005uaxc00000xurs,005tzmr00002le0a",
        '硬装'=>"005qp6b00000ga2p,005pcvc000000q4h,005rw7o00002cfr7,005pgwg00001hb74,005s2ht00000owxd,005niy900006apsi,005od4d0000688md,005qftt000075fuk,005n7sp00002ewd6,005rjw300004t5n8,005pxlv00007exlx,005q2to00000uvi7,005qbf700000owxd,005owal00000xb95,005sxip000002riu,005rlu500006hvle,005np3n000002zga,005s1js000005uil,005psm60000083uk,005osex00004vpxa,005scf600001cwkh,005p3qd000056rsp,005o9ud000056rsp,005n9ws00002ewd6,005pvzq00002cfr7,005n5oh000038b83,005qz8b00006pbjo,005qquj00002yj5c,005o43g000005uil,005oe2000000vnpb,005omnh000028zwq,005mp59000000hf4,005n8mv00000ofnn,005u71p00006wpxa,005u3hu000037cq1,005u2gc00005avso,005u0xa00000mj0i,005tnnx00000rq6l,005tjgz00006asat,005t5cf00008qyec,005szql00001xoub,005eai5000063rez,005aww70000013j9,0050zvf00007azzm,0057bma000008znk,005cxw600003soz1,005ldnk000028zwq,0050hze00003ep53,0051sel000003yac,005u2gc00005avso,005bica00001aj7r,005bbet000010hjq,005c10m00000096w,004btfr000000djo,04io2k000000ap2,00517mw0000018ks",
        '清洁'=>"005rdt4000002et2,005skf5000079bm2,005rrf400007ovj9,005spoq00001uclb,005s3ry0000229qh,005srsq00007bidr,005sq0e00006mn95,005rvfc000053w40,005qhtz00004comz,005rh9r00005g16e,005sguc000000nt5,005rtxk000009srt,005sqmt00001d322,005lwuh000006snx,005twz0000000tz5,005ttnb000003yac,005py1a000003yac,005t2ms0000026rk,005sxcv00003a12v,005oup000000yo4c,005s14b00000s9wt,005emj9000000nt5,005u3vp00008nke4,005ir3s00000i3yl,005qrrp000000mvt,005irnt00000ofnn,05sbtt00007ovj9,005srsq00007bidr,005sadq000008aj3,005u1es000008aj3,005sy2e00005ddz2,005nm3400006v99w,005tgx800001uclb,005to0u000000apu,004zk2n0000072xb,005gbso00000lmtq,005mem600000299g,005joq600005016u,005htxd000000mvt,005qw9k00000hm6o,005th6e000001svl,005or8200005ss09,005s5vz00000lmtq,005qz20000050i01,000l45u000001ucf,005j6er00006o85u,005ndxn00001nnr3,005qqyv00001i44v,005iboa0000688md,0052k2c000000mvt,004330p000002ipr,0015nw20000015dy,005oojd00002cfr7,0052k2c000000mvt,001cz7f000000djo,005tles00002cfr7",
        '软装'=>"005s6wc000053w40,005ob2h0000068q2,005ruj8000006snx,005qtz1000006snx,005rpop00000qcsv,005rsa500000arr2,005nkbv0000704g9,005q2uc000000aex,005r88a000047hs7,005ory4000082tjk,005r0x700000fhqe,005qx2800000arr2,005qwhl00000s9wt,005nagt000034uzy,005nqpv00004wodq,005qud800000mj0i,005qwgp000001fip,005ownp00008oxhw,005syqf00002yj5c,005r4li00000msld,005q0yz00000h4av,005posc000000dcg,005pkb600000h4av,005p0b7000000odm,005o5qg00000h4av,005jk34000009nmu,005jhs400000ompu,005j512000002ipr,005i4kb000000sa0,005hv6j000002ipr,005tvxh000028zwq,005t6ni00001pwf1,005t6eo000000t3u,005t6by00002jwfi,005qyew000000bab,005mi0w00006u48j,005oup000000yo4c,005mykb00000a8wp,005txnf00000ioig,005qxmp000000sa0,005t23o00000ckbp,005t7y50000009dd,005t2b600000mj0i,005srtq000000zdb,005tdsn0000147ed,005qfj200005bavk,005gldi000001fip,005qxst00001cwkh,005m5xi000000kuk,005hz1c000000bt0,0055tg9000001yku,005lesm000000nt5,005inro00006dsrk,005h8pb000002way,005az5g00000l1nz,005m2di0000013j9,005nqme000000ap2,005a3n3000000ap2,005jfa300000542q,0059oyd00000hum4,004tsqt00000r2si,005mxfq00000g1kw,005klgj0000691n7,005p0p200000arr2,005c8g500006nklw,005gztp00005elf,005dib500000abro",
        '厨电'=>"005mhp800000252k,005lyl600005016u,005mkxd00000xb95,005mz1z00005f10c,005n0f200000h16b,005ok6900001e2q3,005oz2d000008ort,005pz3z000000odm,005pz7u00000l1nz,005qbel000003t1u,005qjox0000688md,005ql9p00000g1kw,005qn7l00000098n,005qsmd00000xb95,005qwtq000082tjk,005r4d900000a15g,005rhdp00000bddi,005s1li0000143cg,005shvv00001i44v,005t4in00000bddi,005slhd00000l1nz,005tur400005h12i,005siql000000ap2,005u1jw0000688md,005r3dm00005g16e,005pq9j00003vu36,005bq58000000ebu,005u10x00002mvk7,005szlm000000ljr,005u0ih000001yet,005tz5r00000abro,005tifc000000ebu,005syif00000s9wt,005t72h00000jfr5,005tx3c000006b3d,005ty5s00006qeah,005t5w9000004yz8,005shyk000000wl0,005rqde000000ebu,005rqde000000ebu,005s5ss00001cxyv,005t3sm0000081nm,005sck9000000x1b,005qceu000008fz8,005ojnj00002qln3,005bvun000001426,005p5ez000004ubp,005ner400000i7pu,005qjq3000009srt,005p9ug00000ompu,00593no000007d0w,005i7wb00008csvn,005r9up00004wodq,005rvx0000000t3u,005rs1p00000425m,005qlpq000006snx,005shvd000000art,005s4yy000053p2s,005pq4u00007rvto",
        '生活'=>"005pxro000054xyu,005ndjz000054xyu,005ra0x00005pvv2,005rt9900005pvv2,005nvky00000g1kw,005qh2d00000l1nz,005o58k00000mj0i,005ppgn00000pbx7,005p7g70000379ht,005p7e3000007nn2,005rvem00004kfvi,005tq69000000ebu,005qb6f000000ebu,005q3sd00000ompu,005pz3z000000odm,005ppam000000odm,005oy40000000ap2,005pii7000000odm,005l4ob00000h4av,005k2fd00000l1nz,005jvsw000003yac,005hyjo00000mj0i,005tqor0000379ht,005tg4d00001cwkh,005teby00003bp8u,005t84k000006snx,005t4fc000000nt5,005t3bx000010820,005t2w500000dqwa,005rcuh000006snx,005qqgq000010dpw,005llk000006pvq2,005s0sg0000013j9,005lpox00008exyg,005s60a0000123sl,005ph28000017gw4,005t9qk000002j3j,005teac000019ggl,005i0ag000052lkx,005qw8e00000arr2,005sano000000u5u,005gkic00005h12i,005pffk00002fqrr,00543vt000000apu,005ory8000082tjk.,0055biz000003brv,005i6iy00008adus,005pftd000000mvt,005l72p000000aje,005cjvv00001mle7,005c47300007nmdt,005h9px000008znk,005sng6000008fz8,005tday00001cwkh,005slex00000mj0i,005tp7y000054xyu,005s6qu0000688md,005s0tw0000013j9,005s3kh000000ebu",
    ];
    /**
     * @throws Exception
     */
    public function main()
    {

        $tab_name = $this->getPost('tab_name', '收纳');
        $list = [];
        if(self::TAB_MAP_CONTENT[$tab_name]){
            $obj_ids_str = self::TAB_MAP_CONTENT[$tab_name];
            $obj_ids = explode("," ,$obj_ids_str);
            if($obj_ids && is_array($obj_ids)){
                $haveScanObjs =  SuperBuyerPlanetObj::getTabObjs($this->uid , $tab_name);
//                $sConstKey = \hhz\constant\redis\redisKeys::KEY_B_OTHER_SUPER_BUYER_PLANET_TAB_OBJ;
//                $sCacheKey = $sConstKey."_".$this->uid."_".$tab_name;
//                $redis = new \Hhz\Redis\otherRedis($sConstKey);
//                $haveScanObjs = $redis->smembers($sCacheKey);

                $obj_ids = array_diff($obj_ids , $haveScanObjs);
                shuffle($obj_ids);
            }
            if($obj_ids && is_array($obj_ids)){
                $obj_ids =   array_slice($obj_ids , 0 ,30);
                SuperBuyerPlanetObj::setTabObjs($this->uid , $tab_name , $obj_ids);

//                $sConstKey = \hhz\constant\redis\redisKeys::KEY_B_OTHER_SUPER_BUYER_PLANET_TAB_OBJ;
//                $sCacheKey = $sConstKey."_".$this->uid."_".$tab_name;
//                $redis = new \Hhz\Redis\otherRedis($sConstKey);
//                $redis->del($sCacheKey);
//                $redis->sadd($sCacheKey,$obj_ids);
//                $redis->expire($sConstKey, 60*10);

                $note_info =  HandleNote::handleNote($obj_ids , FormatScene::BASE_INFO);
                $list = array_values($note_info);
                foreach ($list as &$val){
                    $val['statSign'] = basicStatSign::genStatSign(AutoModule::MODULE_COMMON_ACTIVITY_NOTE,[], [ "obj_id" => $val['photo']['photo_info']['id'], 'obj_type' => 0, 'activity_name' => "buyers_land" ,'information'=>$tab_name]);;
                }
            }
        }
        $this->setSuccess( $list);
    }


}